{% extends 'teacher/base.html' %}
{% load customer_filters %}
{% load customer_tags %}
{% load static %}
{% block title %}Python浆果框架管理系统{% endblock %}
{% block link %}
<link rel="stylesheet" href="{% static 'teacher/css/index.css' %}">
{% endblock %}
{% block section %}{{ section }}{% endblock %}
{% block content %}
    <form class="form-inline" method="post">
        {% csrf_token %}
        <div class="form-group">
            <input type="text" class="form-control" id="exampleInputPassword3" placeholder="输入姓名、QQ、电话" name="search" value={{ search }}>
        </div>
            <button type="submit" class="btn btn-default">搜索</button>
            <a type="reset" class="btn btn-primary" href="{{ request.path }}">重置</a>
            <a type="button" class="btn btn-primary" href="{% url 'teacher:add' %}">添加</a>
    </form>
    <table class="table table-striped">
              <thead>
                <tr>
                  <th>序号</th>
                  <th>姓名</th>
                  <th>年龄</th>
                  <th>性别</th>
                  <th>手机</th>
                  <th>QQ</th>
                  <th>微信</th>
                  <th>入学时间</th>
                  <th>操作</th>
                </tr>
              </thead>
              <tbody>
                  {% for stu in stus %}
                    <tr>
                      <td>{{ forloop.counter }}</td>
                      <td><a href="{% url 'teacher:detail' stu.id %}">{{ stu.name }}</a></td>
                      <td>{{ stu.age }}</td>
                      <td>{{ stu.sex|to_sex:'zh' }}</td>
                      <td>{{ stu.mobile }}</td>
                      <td>{{ stu.qq }}</td>
                      <td>{{ stu.webchat }}</td>
                      <td>{{ stu.c_time|date:'Y年m月d日 H:i:s' }}</td>
                      <td>
                        <a type="button" class="btn btn-primary" href="{% url 'teacher:modify' stu.id %}">编辑</a>
                        <a type="button" class="btn btn-danger" href="{% url 'teacher:student_delete' stu.id %}">删除</a>
                      </td>
                    </tr>
                  {% endfor %}
              </tbody>
            </table>
    <nav aria-label="Page navigation" style="display: inline-block">
      {% pagination_html %}
    </nav>
    <!-- Single button -->
    <div class="btn-group" style="display: inline-block;margin-top: -67px">
      <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
      {{ num_perpage }}条/页 <span class="caret"></span>
      </button>
      <ul class="dropdown-menu">
        <li><a href="{% url 'teacher:index' %}?current_page={{ current_page }}&num_perpage=3">3条/页</a></li>
        <li><a href="{% url 'teacher:index' %}?current_page={{ current_page }}&num_perpage=5">5条/页</a></li>
        <li><a href="{% url 'teacher:index' %}?current_page={{ current_page }}&num_perpage=10">10条/页</a></li>
      </ul>
    </div>
{% endblock %}